<template>
    <view @click="handleTap">
        <label :for="name">
            <slot/>
        </label>
        <button :id="name" style="position: absolute;top: -999px;left: -999px;"
                open-type="contact" size="mini"
                :session-from="'udesk|'+contactInfo.nickname+'|'+contactInfo.photo_url+'|customer^'+contactInfo.customer_info_str"
                @contact="contactCallBall">
        </button>
    </view>
</template>

<script>
    import {ContactInfo} from "../../model/ContactInfo";

    export default {

        data() {
            return {
                name: 'button',
                contactInfo: null
            }
        },
        mounted() {
            this.updateData()
        },
        methods: {

            updateData() {
                this.contactInfo = ContactInfo.getContactData()
                console.log('客服信息', this.contactInfo)
            },

            contactCallBall(e) {
                ContactInfo.toUdeskCart(e)
            },

            handleTap() {

            }

        }
    }
</script>

<style lang="scss" scoped>


</style>
